home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / lwings.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  51KB  |  1,279 lines

  1. /***************************************************************************
  2.  
  3.   Legendary Wings
  4.   Section Z
  5.   Trojan
  6.   Avengers
  7.  
  8.   Driver provided by Paul Leaman
  9.  
  10.   Trojan contains a third Z80 to drive the game samples. This third
  11.   Z80 outputs the ADPCM data byte at a time to the sound hardware. Since
  12.   this will be expensive to do this extra processor is not emulated.
  13.  
  14.   Instead, the ADPCM data is lifted directly from the sound ROMS.
  15.  
  16. ***************************************************************************/
  17.  
  18. #include "driver.h"
  19. #include "vidhrdw/generic.h"
  20.  
  21. WRITE_HANDLER( lwings_bankswitch_w );
  22. READ_HANDLER( lwings_bankedrom_r );
  23. int lwings_interrupt(void);
  24. READ_HANDLER( avengers_protection_r );
  25. WRITE_HANDLER( avengers_protection_w );
  26.  
  27. extern unsigned char *lwings_backgroundram;
  28. extern unsigned char *lwings_backgroundattribram;
  29. extern size_t lwings_backgroundram_size;
  30. extern unsigned char *lwings_scrolly;
  31. extern unsigned char *lwings_scrollx;
  32. extern unsigned char *lwings_palette_bank;
  33. WRITE_HANDLER( lwings_background_w );
  34. WRITE_HANDLER( lwings_backgroundattrib_w );
  35. WRITE_HANDLER( lwings_palette_bank_w );
  36. int  lwings_vh_start(void);
  37. void lwings_vh_stop(void);
  38. void lwings_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  39.  
  40. extern unsigned char *trojan_scrolly;
  41. extern unsigned char *trojan_scrollx;
  42. extern unsigned char *trojan_bk_scrolly;
  43. extern unsigned char *trojan_bk_scrollx;
  44. int  avengers_vh_start(void);
  45. int  trojan_vh_start(void);
  46. void trojan_vh_stop(void);
  47. void trojan_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  48.  
  49. WRITE_HANDLER( trojan_sound_cmd_w )
  50. {
  51.        soundlatch_w(offset, data);
  52.        if (data != 0xff && (data & 0x08))
  53.        {
  54.           /*
  55.           I assume that Trojan's ADPCM output is directly derived
  56.           from the sound code. I can't find an output port that
  57.           does this on either the sound board or main board.
  58.           */
  59.           ADPCM_trigger(0, data & 0x07);
  60.     }
  61.  
  62. #if 0
  63.     logerror("Sound Code=%02x\n", data);
  64. #endif
  65. }
  66.  
  67.  
  68. static struct MemoryReadAddress readmem[] =
  69. {
  70.     { 0x0000, 0x7fff, MRA_ROM },   /* CODE */
  71.     { 0x8000, 0xbfff, MRA_BANK1 },  /* CODE */
  72.     { 0xc000, 0xf7ff, MRA_RAM },
  73.     { 0xf808, 0xf808, input_port_0_r },
  74.     { 0xf809, 0xf809, input_port_1_r },
  75.     { 0xf80a, 0xf80a, input_port_2_r },
  76.     { 0xf80b, 0xf80b, input_port_3_r },
  77.     { 0xf80c, 0xf80c, input_port_4_r },
  78.     { 0xf80d, 0xf80d, avengers_protection_r },
  79.     { -1 }  /* end of table */
  80. };
  81.  
  82. static struct MemoryWriteAddress writemem[] =
  83. {
  84.     { 0x0000, 0xbfff, MWA_ROM },
  85.     { 0xc000, 0xddff, MWA_RAM },
  86.     { 0xde00, 0xdfff, MWA_RAM, &spriteram, &spriteram_size },
  87.     { 0xe000, 0xe3ff, videoram_w, &videoram, &videoram_size },
  88.     { 0xe400, 0xe7ff, colorram_w, &colorram },
  89.     { 0xe800, 0xebff, lwings_background_w, &lwings_backgroundram, &lwings_backgroundram_size },
  90.     { 0xec00, 0xefff, lwings_backgroundattrib_w, &lwings_backgroundattribram },
  91.     { 0xf000, 0xf3ff, paletteram_RRRRGGGGBBBBxxxx_split2_w, &paletteram_2 },
  92.     { 0xf400, 0xf7ff, paletteram_RRRRGGGGBBBBxxxx_split1_w, &paletteram },
  93.     { 0xf800, 0xf801, MWA_RAM, &trojan_scrollx },
  94.     { 0xf802, 0xf803, MWA_RAM, &trojan_scrolly },
  95.     { 0xf804, 0xf804, MWA_RAM, &trojan_bk_scrollx },
  96.     { 0xf805, 0xf805, MWA_RAM, &trojan_bk_scrolly },
  97.     { 0xf808, 0xf809, MWA_RAM, &lwings_scrolly},
  98.     { 0xf80a, 0xf80b, MWA_RAM, &lwings_scrollx},
  99.     { 0xf80c, 0xf80c, soundlatch_w },
  100.     { 0xf80d, 0xf80d, watchdog_reset_w },
  101.     { 0xf80e, 0xf80e, lwings_bankswitch_w },
  102.     { -1 }  /* end of table */
  103. };
  104.  
  105. /* TROJAN - intercept sound command write for ADPCM samples */
  106.  
  107. static struct MemoryWriteAddress trojan_writemem[] =
  108. {
  109.     { 0x0000, 0xbfff, MWA_ROM },
  110.     { 0xc000, 0xddff, MWA_RAM },
  111.     { 0xde00, 0xdf7f, MWA_RAM, &spriteram, &spriteram_size },
  112.     { 0xdf80, 0xdfff, MWA_RAM },
  113.     { 0xe000, 0xe3ff, videoram_w, &videoram, &videoram_size },
  114.     { 0xe400, 0xe7ff, colorram_w, &colorram },
  115.     { 0xe800, 0xebff, lwings_background_w, &lwings_backgroundram, &lwings_backgroundram_size },
  116.     { 0xec00, 0xefff, lwings_backgroundattrib_w, &lwings_backgroundattribram },
  117.     { 0xf000, 0xf3ff, paletteram_RRRRGGGGBBBBxxxx_split2_w, &paletteram_2 },
  118.     { 0xf400, 0xf7ff, paletteram_RRRRGGGGBBBBxxxx_split1_w, &paletteram },
  119.     { 0xf800, 0xf801, MWA_RAM, &trojan_scrollx },
  120.     { 0xf802, 0xf803, MWA_RAM, &trojan_scrolly },
  121.     { 0xf804, 0xf804, MWA_RAM, &trojan_bk_scrollx },
  122.     { 0xf805, 0xf805, MWA_RAM, &trojan_bk_scrolly },
  123.     { 0xf809, 0xf809, avengers_protection_w },
  124.     { 0xf80c, 0xf80c, trojan_sound_cmd_w },
  125.     { 0xf80d, 0xf80d, watchdog_reset_w },
  126.     { 0xf80e, 0xf80e, lwings_bankswitch_w },
  127.     { -1 }  /* end of table */
  128. };
  129.  
  130.  
  131.  
  132. static struct MemoryReadAddress sound_readmem[] =
  133. {
  134.     { 0xc000, 0xc7ff, MRA_RAM },
  135.     { 0xc800, 0xc800, soundlatch_r },
  136.     { 0xe006, 0xe006, MRA_RAM },    /* Avengers - ADPCM status?? */
  137.     { 0x0000, 0x7fff, MRA_ROM },
  138.     { -1 }  /* end of table */
  139. };
  140.  
  141. static struct MemoryWriteAddress sound_writemem[] =
  142. {
  143.     { 0xc000, 0xc7ff, MWA_RAM },
  144.     { 0xe000, 0xe000, YM2203_control_port_0_w },
  145.     { 0xe001, 0xe001, YM2203_write_port_0_w },
  146.     { 0xe002, 0xe002, YM2203_control_port_1_w },
  147.     { 0xe003, 0xe003, YM2203_write_port_1_w },
  148.     { 0xe006, 0xe006, MWA_RAM },    /* Avengers - ADPCM output??? */
  149.     { 0x0000, 0x7fff, MWA_ROM },
  150.     { -1 }  /* end of table */
  151. };
  152.  
  153. INPUT_PORTS_START( sectionz )
  154.     PORT_START      /* IN0 */
  155.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  156.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  157.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  158.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  159.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  160.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  161.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  162.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  163.  
  164.     PORT_START      /* IN1 */
  165.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  166.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  167.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  168.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  169.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  170.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  171.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  172.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  173.  
  174.     PORT_START      /* IN2 */
  175.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  176.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  177.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  178.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  179.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  180.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  181.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  182.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  183.  
  184.     PORT_START      /* DSW0 */
  185.     PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
  186.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  187.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  188.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  189.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  190.     PORT_DIPSETTING(    0x04, "2" )
  191.     PORT_DIPSETTING(    0x0c, "3" )
  192.     PORT_DIPSETTING(    0x08, "4" )
  193.     PORT_DIPSETTING(    0x00, "5" )
  194.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  195.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  196.     PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
  197.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  198.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  199.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  200.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  201.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  202.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  203.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  204.  
  205.     PORT_START      /* DSW1 */
  206.     PORT_DIPNAME( 0x01, 0x01, "Allow Continue" )
  207.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  208.     PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
  209.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  210.     PORT_DIPSETTING(    0x02, "Easy" )
  211.     PORT_DIPSETTING(    0x06, "Normal" )
  212.     PORT_DIPSETTING(    0x04, "Difficult" )
  213.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  214.     PORT_DIPNAME( 0x38, 0x38, DEF_STR( Bonus_Life ) )
  215.     PORT_DIPSETTING(    0x38, "20000 50000" )
  216.     PORT_DIPSETTING(    0x18, "20000 60000" )
  217.     PORT_DIPSETTING(    0x28, "20000 70000" )
  218.     PORT_DIPSETTING(    0x08, "30000 60000" )
  219.     PORT_DIPSETTING(    0x30, "30000 70000" )
  220.     PORT_DIPSETTING(    0x10, "30000 80000" )
  221.     PORT_DIPSETTING(    0x20, "40000 100000" )
  222.     PORT_DIPSETTING(    0x00, "None" )
  223.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Cabinet ) )
  224.     PORT_DIPSETTING(    0x00, "Upright One Player" )
  225.     PORT_DIPSETTING(    0x40, "Upright Two Players" )
  226. /*      PORT_DIPSETTING(    0x80, "???" )       probably unused */
  227.     PORT_DIPSETTING(    0xc0, DEF_STR( Cocktail ) )
  228. INPUT_PORTS_END
  229.  
  230. INPUT_PORTS_START( lwings )
  231.     PORT_START      /* IN0 */
  232.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  233.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  234.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  235.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  236.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  237.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  238.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  239.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  240.  
  241.     PORT_START      /* IN1 */
  242.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  243.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  244.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  245.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  246.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  247.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  248.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  249.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  250.  
  251.     PORT_START      /* IN2 */
  252.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  253.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  254.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  255.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  256.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  257.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  258.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  259.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  260.  
  261.     PORT_START      /* DSW0 */
  262.     PORT_DIPNAME( 0x03, 0x03, "Unknown 1/2" )
  263.     PORT_DIPSETTING(    0x00, "0" )
  264.     PORT_DIPSETTING(    0x01, "1" )
  265.     PORT_DIPSETTING(    0x02, "2" )
  266.     PORT_DIPSETTING(    0x03, "3" )
  267.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  268.     PORT_DIPSETTING(    0x0c, "3" )
  269.     PORT_DIPSETTING(    0x04, "4" )
  270.     PORT_DIPSETTING(    0x08, "5" )
  271.     PORT_DIPSETTING(    0x00, "6" )
  272.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_B ) )
  273.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  274.     PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
  275.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  276.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  277.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_A ) )
  278.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  279.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_4C ) )
  280.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  281.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  282.  
  283.     PORT_START      /* DSW1 */
  284.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  285.     PORT_DIPSETTING(    0x00, "0" )
  286.     PORT_DIPSETTING(    0x01, "1" )
  287.     PORT_DIPNAME( 0x06, 0x06, "Difficulty?" )
  288.     PORT_DIPSETTING(    0x02, "Easy?" )
  289.     PORT_DIPSETTING(    0x06, "Normal?" )
  290.     PORT_DIPSETTING(    0x04, "Difficult?" )
  291.     PORT_DIPSETTING(    0x00, "Very Difficult?" )
  292.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  293.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  294.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  295.     PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
  296.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  297.     PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
  298.     PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Bonus_Life ) )
  299.     PORT_DIPSETTING(    0xe0, "20000 50000" )
  300.     PORT_DIPSETTING(    0x60, "20000 60000" )
  301.     PORT_DIPSETTING(    0xa0, "20000 70000" )
  302.     PORT_DIPSETTING(    0x20, "30000 60000" )
  303.     PORT_DIPSETTING(    0xc0, "30000 70000" )
  304.     PORT_DIPSETTING(    0x40, "30000 80000" )
  305.     PORT_DIPSETTING(    0x80, "40000 100000" )
  306.     PORT_DIPSETTING(    0x00, "None" )
  307. INPUT_PORTS_END
  308.  
  309. INPUT_PORTS_START( trojan )
  310.     PORT_START      /* IN0 */
  311.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  312.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  313.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  314.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  315.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  316.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  317.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  318.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  319.  
  320.     PORT_START      /* IN1 */
  321.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  322.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  323.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  324.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  325.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  326.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  327.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  328.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  329.  
  330.     PORT_START      /* IN2 */
  331.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  332.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  333.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  334.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  335.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  336.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  337.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  338.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  339.  
  340.     PORT_START      /* DSW0 */
  341.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Cabinet ) )
  342.     PORT_DIPSETTING(    0x00, "Upright 1 Player" )
  343.     PORT_DIPSETTING(    0x02, "Upright 2 Players" )
  344.     PORT_DIPSETTING(    0x03, DEF_STR( Cocktail ) )
  345. /* 0x01 same as 0x02 or 0x03 */
  346.     PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Bonus_Life ) )
  347.     PORT_DIPSETTING(    0x10, "20000 60000" )
  348.     PORT_DIPSETTING(    0x0c, "20000 70000" )
  349.     PORT_DIPSETTING(    0x08, "20000 80000" )
  350.     PORT_DIPSETTING(    0x1c, "30000 60000" )
  351.     PORT_DIPSETTING(    0x18, "30000 70000" )
  352.     PORT_DIPSETTING(    0x14, "30000 80000" )
  353.     PORT_DIPSETTING(    0x04, "40000 80000" )
  354.     PORT_DIPSETTING(    0x00, "None" )
  355.     PORT_DIPNAME( 0xe0, 0xe0, "Starting Level" )
  356.     PORT_DIPSETTING(    0xe0, "1" )
  357.     PORT_DIPSETTING(    0xc0, "2" )
  358.     PORT_DIPSETTING(    0xa0, "3" )
  359.     PORT_DIPSETTING(    0x80, "4" )
  360.     PORT_DIPSETTING(    0x60, "5" )
  361.     PORT_DIPSETTING(    0x40, "6" )
  362. /* 0x00 and 0x20 start at level 6 */
  363.  
  364.     PORT_START      /* DSW1 */
  365.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  366.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  367.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  368.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  369.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  370.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  371.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  372.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
  373.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  374.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  375.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  376.     PORT_DIPSETTING(    0x20, "2" )
  377.     PORT_DIPSETTING(    0x30, "3" )
  378.     PORT_DIPSETTING(    0x10, "4" )
  379.     PORT_DIPSETTING(    0x00, "5" )
  380.     PORT_DIPNAME( 0x40, 0x40, "Flip Screen?" )
  381.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  382.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  383.     PORT_DIPNAME( 0x80, 0x80, "Allow Continue" )
  384.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  385.     PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
  386. INPUT_PORTS_END
  387.  
  388. /* Trojan with level selection - starting level dip switches not used */
  389. INPUT_PORTS_START( trojanls )
  390.     PORT_START      /* IN0 */
  391.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  392.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  393.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  394.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  395.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  396.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  397.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  398.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  399.  
  400.     PORT_START      /* IN1 */
  401.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  402.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  403.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  404.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  405.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  406.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  407.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  408.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  409.  
  410.     PORT_START      /* IN2 */
  411.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  412.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  413.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  414.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  415.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  416.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  417.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  418.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  419.  
  420.     PORT_START      /* DSW0 */
  421.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Cabinet ) )
  422.     PORT_DIPSETTING(    0x00, "Upright 1 Player" )
  423.     PORT_DIPSETTING(    0x02, "Upright 2 Players" )
  424.     PORT_DIPSETTING(    0x03, DEF_STR( Cocktail ) )
  425. /* 0x01 same as 0x02 or 0x03 */
  426.     PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Bonus_Life ) )
  427.     PORT_DIPSETTING(    0x10, "20000 60000" )
  428.     PORT_DIPSETTING(    0x0c, "20000 70000" )
  429.     PORT_DIPSETTING(    0x08, "20000 80000" )
  430.     PORT_DIPSETTING(    0x1c, "30000 60000" )
  431.     PORT_DIPSETTING(    0x18, "30000 70000" )
  432.     PORT_DIPSETTING(    0x14, "30000 80000" )
  433.     PORT_DIPSETTING(    0x04, "40000 80000" )
  434.     PORT_DIPSETTING(    0x00, "None" )
  435.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  436.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  437.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  438.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  439.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  440.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  441.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  442.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  443.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  444.  
  445.     PORT_START      /* DSW1 */
  446.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  447.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  448.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  449.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  450.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  451.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  452.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  453.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
  454.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  455.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  456.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  457.     PORT_DIPSETTING(    0x20, "2" )
  458.     PORT_DIPSETTING(    0x30, "3" )
  459.     PORT_DIPSETTING(    0x10, "4" )
  460.     PORT_DIPSETTING(    0x00, "5" )
  461.     PORT_DIPNAME( 0x40, 0x40, "Flip Screen?" )
  462.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  463.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  464.     PORT_DIPNAME( 0x80, 0x80, "Allow Continue" )
  465.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  466.     PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
  467. INPUT_PORTS_END
  468.  
  469.  
  470.  
  471. static struct GfxLayout charlayout =
  472. {
  473.     8,8,    /* 8*8 characters */
  474.     1024,   /* 1024 characters */
  475.     2,      /* 2 bits per pixel */
  476.     { 0, 4 },
  477.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
  478.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  479.     16*8    /* every char takes 16 consecutive bytes */
  480. };
  481.  
  482. static struct GfxLayout tilelayout =
  483. {
  484.     16,16,  /* 16*16 tiles */
  485.     2048,   /* 2048 tiles */
  486.     4,      /* 4 bits per pixel */
  487.     { 0x30000*8, 0x20000*8, 0x10000*8, 0x00000*8  },  /* the bitplanes are separated */
  488.     { 0, 1, 2, 3, 4, 5, 6, 7,
  489.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
  490.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  491.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  492.     32*8    /* every tile takes 32 consecutive bytes */
  493. };
  494.  
  495. static struct GfxLayout spritelayout =
  496. {
  497.     16,16,  /* 16*16 sprites */
  498.     1024,   /* 1024 sprites */
  499.     4,      /* 4 bits per pixel */
  500.     { 0x10000*8+4, 0x10000*8+0, 4, 0 },
  501.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
  502.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
  503.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  504.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  505.     64*8    /* every sprite takes 64 consecutive bytes */
  506. };
  507.  
  508. static struct GfxLayout spritelayout_trojan = /* LWings, with more sprites */
  509. {
  510.     16,16,  /* 16*16 sprites */
  511.     2048,   /* 2048 sprites */
  512.     4,      /* 4 bits per pixel */
  513.     { 0x20000*8+4, 0x20000*8+0, 4, 0 },
  514.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
  515.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
  516.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  517.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  518.     64*8    /* every sprite takes 64 consecutive bytes */
  519. };
  520.  
  521. static struct GfxLayout bktilelayout_trojan =
  522. {
  523.     16,16,  /* 16*16 sprites */
  524.     512,   /* 512 sprites */
  525.     4,      /* 4 bits per pixel */
  526.     { 0x08000*8+0, 0x08000*8+4, 0, 4 },
  527.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
  528.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
  529.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  530.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  531.     64*8    /* every sprite takes 64 consecutive bytes */
  532. };
  533.  
  534.  
  535. static struct GfxDecodeInfo gfxdecodeinfo[] =
  536. {
  537.     { REGION_GFX1, 0, &charlayout,   512, 16 }, /* colors 512-575 */
  538.     { REGION_GFX2, 0, &tilelayout,     0,  8 }, /* colors   0-127 */
  539.     { REGION_GFX3, 0, &spritelayout, 384,  8 }, /* colors 384-511 */
  540.     { -1 } /* end of array */
  541. };
  542.  
  543. static struct GfxDecodeInfo gfxdecodeinfo_trojan[] =
  544. {
  545.     { REGION_GFX1, 0, &charlayout,          768, 16 },  /* colors 768-831 */
  546.     { REGION_GFX2, 0, &tilelayout,          256,  8 },  /* colors 256-383 */
  547.     { REGION_GFX3, 0, &spritelayout_trojan, 640,  8 },  /* colors 640-767 */
  548.     { REGION_GFX4, 0, &bktilelayout_trojan,   0,  8 },  /* colors   0-127 */
  549.     { -1 } /* end of array */
  550. };
  551.  
  552.  
  553.  
  554. static struct YM2203interface ym2203_interface =
  555. {
  556.     2,                      /* 2 chips */
  557.     1500000,        /* 1.5 MHz (?) */
  558.     { YM2203_VOL(10,20), YM2203_VOL(10,20) },
  559.     { 0 },
  560.     { 0 },
  561.     { 0 },
  562.     { 0 }
  563. };
  564.  
  565.  
  566.  
  567. static struct MachineDriver machine_driver_lwings =
  568. {
  569.     /* basic machine hardware */
  570.     {
  571.         {
  572.             CPU_Z80,
  573.             4000000,        /* 4 Mhz (?) */
  574.             readmem,writemem,0,0,
  575.             lwings_interrupt,1
  576.         },
  577.         {
  578.             CPU_Z80 | CPU_AUDIO_CPU,
  579.             3000000,        /* 3 Mhz (?) */
  580.             sound_readmem,sound_writemem,0,0,
  581.             interrupt,4
  582.         }
  583.     },
  584.     60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
  585.     1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  586.     0,
  587.  
  588.     /* video hardware */
  589.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
  590.     gfxdecodeinfo,
  591.     1024, 1024,
  592.     0,
  593.  
  594.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  595.     0,
  596.     lwings_vh_start,
  597.     lwings_vh_stop,
  598.     lwings_vh_screenrefresh,
  599.  
  600.     /* sound hardware */
  601.     0,0,0,0,
  602.     {
  603.         {
  604.             SOUND_YM2203,
  605.             &ym2203_interface
  606.         }
  607.     }
  608. };
  609.  
  610.  
  611. /***************************************************************************
  612.  
  613.   Game driver(s)
  614.  
  615. ***************************************************************************/
  616.  
  617. ROM_START( lwings )
  618.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  619.     ROM_LOAD( "6c_lw01.bin",  0x00000, 0x8000, 0xb55a7f60 )
  620.     ROM_LOAD( "7c_lw02.bin",  0x10000, 0x8000, 0xa5efbb1b )
  621.     ROM_LOAD( "9c_lw03.bin",  0x18000, 0x8000, 0xec5cc201 )
  622.  
  623.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  624.     ROM_LOAD( "11e_lw04.bin", 0x0000, 0x8000, 0xa20337a2 )
  625.  
  626.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  627.     ROM_LOAD( "9h_lw05.bin",  0x00000, 0x4000, 0x091d923c ) /* characters */
  628.  
  629.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  630.     ROM_LOAD( "3e_lw14.bin",  0x00000, 0x8000, 0x5436392c ) /* tiles */
  631.     ROM_LOAD( "1e_lw08.bin",  0x08000, 0x8000, 0xb491bbbb )
  632.     ROM_LOAD( "3d_lw13.bin",  0x10000, 0x8000, 0xfdd1908a )
  633.     ROM_LOAD( "1d_lw07.bin",  0x18000, 0x8000, 0x5c73d406 )
  634.     ROM_LOAD( "3b_lw12.bin",  0x20000, 0x8000, 0x32e17b3c )
  635.     ROM_LOAD( "1b_lw06.bin",  0x28000, 0x8000, 0x52e533c1 )
  636.     ROM_LOAD( "3f_lw15.bin",  0x30000, 0x8000, 0x99e134ba )
  637.     ROM_LOAD( "1f_lw09.bin",  0x38000, 0x8000, 0xc8f28777 )
  638.  
  639.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  640.     ROM_LOAD( "3j_lw17.bin",  0x00000, 0x8000, 0x5ed1bc9b )  /* sprites */
  641.     ROM_LOAD( "1j_lw11.bin",  0x08000, 0x8000, 0x2a0790d6 )
  642.     ROM_LOAD( "3h_lw16.bin",  0x10000, 0x8000, 0xe8834006 )
  643.     ROM_LOAD( "1h_lw10.bin",  0x18000, 0x8000, 0xb693f5a5 )
  644. ROM_END
  645.  
  646. ROM_START( lwings2 )
  647.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  648.     ROM_LOAD( "u13-l",        0x00000, 0x8000, 0x3069c01c )
  649.     ROM_LOAD( "u14-k",        0x10000, 0x8000, 0x5d91c828 )
  650.     ROM_LOAD( "9c_lw03.bin",  0x18000, 0x8000, 0xec5cc201 )
  651.  
  652.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  653.     ROM_LOAD( "11e_lw04.bin", 0x0000, 0x8000, 0xa20337a2 )
  654.  
  655.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  656.     ROM_LOAD( "9h_lw05.bin",  0x00000, 0x4000, 0x091d923c )  /* characters */
  657.  
  658.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  659.     ROM_LOAD( "b_03e.rom",    0x00000, 0x8000, 0x176e3027 )  /* tiles */
  660.     ROM_LOAD( "b_01e.rom",    0x08000, 0x8000, 0xf5d25623 )
  661.     ROM_LOAD( "b_03d.rom",    0x10000, 0x8000, 0x001caa35 )
  662.     ROM_LOAD( "b_01d.rom",    0x18000, 0x8000, 0x0ba008c3 )
  663.     ROM_LOAD( "b_03b.rom",    0x20000, 0x8000, 0x4f8182e9 )
  664.     ROM_LOAD( "b_01b.rom",    0x28000, 0x8000, 0xf1617374 )
  665.     ROM_LOAD( "b_03f.rom",    0x30000, 0x8000, 0x9b374dcc )
  666.     ROM_LOAD( "b_01f.rom",    0x38000, 0x8000, 0x23654e0a )
  667.  
  668.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  669.     ROM_LOAD( "b_03j.rom",    0x00000, 0x8000, 0x8f3c763a )  /* sprites */
  670.     ROM_LOAD( "b_01j.rom",    0x08000, 0x8000, 0x7cc90a1d )
  671.     ROM_LOAD( "b_03h.rom",    0x10000, 0x8000, 0x7d58f532 )
  672.     ROM_LOAD( "b_01h.rom",    0x18000, 0x8000, 0x3e396eda )
  673. ROM_END
  674.  
  675. ROM_START( lwingsjp )
  676.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  677.     ROM_LOAD( "a_06c.rom",    0x00000, 0x8000, 0x2068a738 )
  678.     ROM_LOAD( "a_07c.rom",    0x10000, 0x8000, 0xd6a2edc4 )
  679.     ROM_LOAD( "9c_lw03.bin",  0x18000, 0x8000, 0xec5cc201 )
  680.  
  681.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  682.     ROM_LOAD( "11e_lw04.bin", 0x0000, 0x8000, 0xa20337a2 )
  683.  
  684.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  685.     ROM_LOAD( "9h_lw05.bin",  0x00000, 0x4000, 0x091d923c )  /* characters */
  686.  
  687.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  688.     ROM_LOAD( "b_03e.rom",    0x00000, 0x8000, 0x176e3027 )  /* tiles */
  689.     ROM_LOAD( "b_01e.rom",    0x08000, 0x8000, 0xf5d25623 )
  690.     ROM_LOAD( "b_03d.rom",    0x10000, 0x8000, 0x001caa35 )
  691.     ROM_LOAD( "b_01d.rom",    0x18000, 0x8000, 0x0ba008c3 )
  692.     ROM_LOAD( "b_03b.rom",    0x20000, 0x8000, 0x4f8182e9 )
  693.     ROM_LOAD( "b_01b.rom",    0x28000, 0x8000, 0xf1617374 )
  694.     ROM_LOAD( "b_03f.rom",    0x30000, 0x8000, 0x9b374dcc )
  695.     ROM_LOAD( "b_01f.rom",    0x38000, 0x8000, 0x23654e0a )
  696.  
  697.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  698.     ROM_LOAD( "b_03j.rom",    0x00000, 0x8000, 0x8f3c763a )  /* sprites */
  699.     ROM_LOAD( "b_01j.rom",    0x08000, 0x8000, 0x7cc90a1d )
  700.     ROM_LOAD( "b_03h.rom",    0x10000, 0x8000, 0x7d58f532 )
  701.     ROM_LOAD( "b_01h.rom",    0x18000, 0x8000, 0x3e396eda )
  702. ROM_END
  703.  
  704.  
  705.  
  706. /***************************************************************
  707.  
  708.  Section Z
  709.  =========
  710.  
  711.    Exactly the same hardware as legendary wings, apart from the
  712.    graphics orientation.
  713.  
  714. ***************************************************************/
  715.  
  716.  
  717. ROM_START( sectionz )
  718.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  719.     ROM_LOAD( "6c_sz01.bin",  0x00000, 0x8000, 0x69585125 )
  720.     ROM_LOAD( "7c_sz02.bin",  0x10000, 0x8000, 0x22f161b8 )
  721.     ROM_LOAD( "9c_sz03.bin",  0x18000, 0x8000, 0x4c7111ed )
  722.  
  723.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  724.     ROM_LOAD( "11e_sz04.bin", 0x0000, 0x8000, 0xa6073566 )
  725.  
  726.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  727.     ROM_LOAD( "9h_sz05.bin",  0x00000, 0x4000, 0x3173ba2e )  /* characters */
  728.  
  729.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  730.     ROM_LOAD( "3e_sz14.bin",  0x00000, 0x8000, 0x63782e30 )  /* tiles */
  731.     ROM_LOAD( "1e_sz08.bin",  0x08000, 0x8000, 0xd57d9f13 )
  732.     ROM_LOAD( "3d_sz13.bin",  0x10000, 0x8000, 0x1b3d4d7f )
  733.     ROM_LOAD( "1d_sz07.bin",  0x18000, 0x8000, 0xf5b3a29f )
  734.     ROM_LOAD( "3b_sz12.bin",  0x20000, 0x8000, 0x11d47dfd )
  735.     ROM_LOAD( "1b_sz06.bin",  0x28000, 0x8000, 0xdf703b68 )
  736.     ROM_LOAD( "3f_sz15.bin",  0x30000, 0x8000, 0x36bb9bf7 )
  737.     ROM_LOAD( "1f_sz09.bin",  0x38000, 0x8000, 0xda8f06c9 )
  738.  
  739.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  740.     ROM_LOAD( "3j_sz17.bin",  0x00000, 0x8000, 0x8df7b24a )  /* sprites */
  741.     ROM_LOAD( "1j_sz11.bin",  0x08000, 0x8000, 0x685d4c54 )
  742.     ROM_LOAD( "3h_sz16.bin",  0x10000, 0x8000, 0x500ff2bb )
  743.     ROM_LOAD( "1h_sz10.bin",  0x18000, 0x8000, 0x00b3d244 )
  744. ROM_END
  745.  
  746. ROM_START( sctionza )
  747.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  748.     ROM_LOAD( "sz-01a.bin",   0x00000, 0x8000, 0x98df49fd )
  749.     ROM_LOAD( "7c_sz02.bin",  0x10000, 0x8000, 0x22f161b8 )
  750.     ROM_LOAD( "sz-03j.bin",   0x18000, 0x8000, 0x94547abf )
  751.  
  752.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  753.     ROM_LOAD( "11e_sz04.bin", 0x0000, 0x8000, 0xa6073566 )
  754.  
  755.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  756.     ROM_LOAD( "9h_sz05.bin",  0x00000, 0x4000, 0x3173ba2e )  /* characters */
  757.  
  758.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  759.     ROM_LOAD( "3e_sz14.bin",  0x00000, 0x8000, 0x63782e30 )  /* tiles */
  760.     ROM_LOAD( "1e_sz08.bin",  0x08000, 0x8000, 0xd57d9f13 )
  761.     ROM_LOAD( "3d_sz13.bin",  0x10000, 0x8000, 0x1b3d4d7f )
  762.     ROM_LOAD( "1d_sz07.bin",  0x18000, 0x8000, 0xf5b3a29f )
  763.     ROM_LOAD( "3b_sz12.bin",  0x20000, 0x8000, 0x11d47dfd )
  764.     ROM_LOAD( "1b_sz06.bin",  0x28000, 0x8000, 0xdf703b68 )
  765.     ROM_LOAD( "3f_sz15.bin",  0x30000, 0x8000, 0x36bb9bf7 )
  766.     ROM_LOAD( "1f_sz09.bin",  0x38000, 0x8000, 0xda8f06c9 )
  767.  
  768.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  769.     ROM_LOAD( "3j_sz17.bin",  0x00000, 0x8000, 0x8df7b24a )  /* sprites */
  770.     ROM_LOAD( "1j_sz11.bin",  0x08000, 0x8000, 0x685d4c54 )
  771.     ROM_LOAD( "3h_sz16.bin",  0x10000, 0x8000, 0x500ff2bb )
  772.     ROM_LOAD( "1h_sz10.bin",  0x18000, 0x8000, 0x00b3d244 )
  773. ROM_END
  774.  
  775.  
  776.  
  777. /***************************************************************
  778.  
  779.  Trojan
  780.  ======
  781.  
  782.    Similar to Legendary Wings apart from:
  783.    1) More sprites
  784.    2) 3rd Z80 (ADPCM)
  785.    3) Different palette layout
  786.    4) Third Background tile layer
  787.  
  788. ***************************************************************/
  789.  
  790.  
  791.  
  792. /*
  793. ADPCM is driven by Z80 continuously outputting to a port. The following
  794. table is lifted from the code.
  795.  
  796. Sample 5 doesn't play properly.
  797. */
  798.  
  799. struct ADPCMsample trojan_samples[] =
  800. {
  801.     { 0x00, 0x00a7, (0x0aa9-0x00a7)*2 },
  802.     { 0x01, 0x0aa9, (0x12ab-0x0aa9)*2 },
  803.     { 0x02, 0x12ab, (0x17ad-0x12ab)*2 },
  804.     { 0x03, 0x17ad, (0x22af-0x17ad)*2 },
  805.     { 0x04, 0x22af, (0x2db1-0x22af)*2 },
  806.     { 0x05, 0x2db1, (0x310a-0x2db1)*2 },
  807.     { 0x06, 0x310a, (0x3cb3-0x310a)*2 }
  808. };
  809.  
  810. static void trojan_adpcm_init(const struct ADPCMinterface *adpcm_intf, struct ADPCMsample *sample_list, int max)
  811. {
  812.     memcpy(sample_list,trojan_samples,sizeof(trojan_samples));
  813. }
  814.  
  815. static struct ADPCMinterface trojan_adpcm_interface =
  816. {
  817.     1,                      /* 1 channel */
  818.     4000,                   /* 4000Hz playback */
  819.     REGION_CPU3,            /* memory region */
  820.     trojan_adpcm_init,        /* init function */
  821.     { 255 }
  822. };
  823.  
  824. static struct MachineDriver machine_driver_trojan =
  825. {
  826.     /* basic machine hardware */
  827.     {
  828.         {
  829.             CPU_Z80,
  830.             4000000,        /* 4 Mhz (?) */
  831.             readmem,trojan_writemem,0,0,
  832.             lwings_interrupt,1
  833.         },
  834.         {
  835.             CPU_Z80 | CPU_AUDIO_CPU,
  836.             3000000,        /* 3 Mhz (?) */
  837.             sound_readmem,sound_writemem,0,0,
  838.             interrupt,4
  839.         }
  840.     },
  841.     60, 2500,       /* frames per second, vblank duration */
  842.                 /* hand tuned to get rid of sprite lag */
  843.     1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  844.     0,
  845.  
  846.     /* video hardware */
  847.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
  848.     gfxdecodeinfo_trojan,
  849.     1024, 1024,
  850.     0,
  851.  
  852.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_AFTER_VBLANK,
  853.     0,
  854.     trojan_vh_start,
  855.     trojan_vh_stop,
  856.     trojan_vh_screenrefresh,
  857.  
  858.     /* sound hardware */
  859.     0,0,0,0,
  860.     {
  861.         {
  862.             SOUND_YM2203,
  863.             &ym2203_interface,
  864.         },
  865.         {
  866.             SOUND_ADPCM,
  867.             &trojan_adpcm_interface
  868.         }
  869.     }
  870. };
  871.  
  872. ROM_START( trojan )
  873.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  874.     ROM_LOAD( "t4",           0x00000, 0x8000, 0xc1bbeb4e )
  875.     ROM_LOAD( "t6",           0x10000, 0x8000, 0xd49592ef )
  876.     ROM_LOAD( "tb05.bin",     0x18000, 0x8000, 0x9273b264 )
  877.  
  878.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  879.     ROM_LOAD( "tb02.bin",     0x0000, 0x8000, 0x21154797 )
  880.  
  881.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for ADPCM CPU (CPU not emulated) */
  882.     ROM_LOAD( "tb01.bin",     0x0000, 0x4000, 0x1c0f91b2 )
  883.  
  884.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  885.     ROM_LOAD( "tb03.bin",     0x00000, 0x4000, 0x581a2b4c )     /* characters */
  886.  
  887.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  888.     ROM_LOAD( "tb13.bin",     0x00000, 0x8000, 0x285a052b )     /* tiles */
  889.     ROM_LOAD( "tb09.bin",     0x08000, 0x8000, 0xaeb693f7 )
  890.     ROM_LOAD( "tb12.bin",     0x10000, 0x8000, 0xdfb0fe5c )
  891.     ROM_LOAD( "tb08.bin",     0x18000, 0x8000, 0xd3a4c9d1 )
  892.     ROM_LOAD( "tb11.bin",     0x20000, 0x8000, 0x00f0f4fd )
  893.     ROM_LOAD( "tb07.bin",     0x28000, 0x8000, 0xdff2ee02 )
  894.     ROM_LOAD( "tb14.bin",     0x30000, 0x8000, 0x14bfac18 )
  895.     ROM_LOAD( "tb10.bin",     0x38000, 0x8000, 0x71ba8a6d )
  896.  
  897.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  898.     ROM_LOAD( "tb18.bin",     0x00000, 0x8000, 0x862c4713 )     /* sprites */
  899.     ROM_LOAD( "tb16.bin",     0x08000, 0x8000, 0xd86f8cbd )
  900.     ROM_LOAD( "tb17.bin",     0x10000, 0x8000, 0x12a73b3f )
  901.     ROM_LOAD( "tb15.bin",     0x18000, 0x8000, 0xbb1a2769 )
  902.     ROM_LOAD( "tb22.bin",     0x20000, 0x8000, 0x39daafd4 )
  903.     ROM_LOAD( "tb20.bin",     0x28000, 0x8000, 0x94615d2a )
  904.     ROM_LOAD( "tb21.bin",     0x30000, 0x8000, 0x66c642bd )
  905.     ROM_LOAD( "tb19.bin",     0x38000, 0x8000, 0x81d5ab36 )
  906.  
  907.     ROM_REGION( 0x10000, REGION_GFX4 | REGIONFLAG_DISPOSE )
  908.     ROM_LOAD( "tb25.bin",     0x00000, 0x8000, 0x6e38c6fa )     /* Bk Tiles */
  909.     ROM_LOAD( "tb24.bin",     0x08000, 0x8000, 0x14fc6cf2 )
  910.  
  911.     ROM_REGION( 0x08000, REGION_GFX5 )
  912.     ROM_LOAD( "tb23.bin",     0x00000, 0x08000, 0xeda13c0e )  /* Tile Map */
  913. ROM_END
  914.  
  915. ROM_START( trojanr )
  916.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  917.     ROM_LOAD( "tb04.bin",     0x00000, 0x8000, 0x92670f27 )
  918.     ROM_LOAD( "tb06.bin",     0x10000, 0x8000, 0xa4951173 )
  919.     ROM_LOAD( "tb05.bin",     0x18000, 0x8000, 0x9273b264 )
  920.  
  921.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  922.     ROM_LOAD( "tb02.bin",     0x0000, 0x8000, 0x21154797 )
  923.  
  924.     ROM_REGION( 0x10000, REGION_CPU3 ) /* 64k for ADPCM CPU (CPU not emulated) */
  925.     ROM_LOAD( "tb01.bin",     0x0000, 0x4000, 0x1c0f91b2 )
  926.  
  927.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  928.     ROM_LOAD( "tb03.bin",     0x00000, 0x4000, 0x581a2b4c )     /* characters */
  929.  
  930.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  931.     ROM_LOAD( "tb13.bin",     0x00000, 0x8000, 0x285a052b )     /* tiles */
  932.     ROM_LOAD( "tb09.bin",     0x08000, 0x8000, 0xaeb693f7 )
  933.     ROM_LOAD( "tb12.bin",     0x10000, 0x8000, 0xdfb0fe5c )
  934.     ROM_LOAD( "tb08.bin",     0x18000, 0x8000, 0xd3a4c9d1 )
  935.     ROM_LOAD( "tb11.bin",     0x20000, 0x8000, 0x00f0f4fd )
  936.     ROM_LOAD( "tb07.bin",     0x28000, 0x8000, 0xdff2ee02 )
  937.     ROM_LOAD( "tb14.bin",     0x30000, 0x8000, 0x14bfac18 )
  938.     ROM_LOAD( "tb10.bin",     0x38000, 0x8000, 0x71ba8a6d )
  939.  
  940.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  941.     ROM_LOAD( "tb18.bin",     0x00000, 0x8000, 0x862c4713 )     /* sprites */
  942.     ROM_LOAD( "tb16.bin",     0x08000, 0x8000, 0xd86f8cbd )
  943.     ROM_LOAD( "tb17.bin",     0x10000, 0x8000, 0x12a73b3f )
  944.     ROM_LOAD( "tb15.bin",     0x18000, 0x8000, 0xbb1a2769 )
  945.     ROM_LOAD( "tb22.bin",     0x20000, 0x8000, 0x39daafd4 )
  946.     ROM_LOAD( "tb20.bin",     0x28000, 0x8000, 0x94615d2a )
  947.     ROM_LOAD( "tb21.bin",     0x30000, 0x8000, 0x66c642bd )
  948.     ROM_LOAD( "tb19.bin",     0x38000, 0x8000, 0x81d5ab36 )
  949.  
  950.     ROM_REGION( 0x10000, REGION_GFX4 | REGIONFLAG_DISPOSE )
  951.     ROM_LOAD( "tb25.bin",     0x00000, 0x8000, 0x6e38c6fa )     /* Bk Tiles */
  952.     ROM_LOAD( "tb24.bin",     0x08000, 0x8000, 0x14fc6cf2 )
  953.  
  954.     ROM_REGION( 0x08000, REGION_GFX5 )
  955.     ROM_LOAD( "tb23.bin",     0x00000, 0x08000, 0xeda13c0e )  /* Tile Map */
  956. ROM_END
  957.  
  958. ROM_START( trojanj )
  959.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  960.     ROM_LOAD( "troj-04.rom",  0x00000, 0x8000, 0x0b5a7f49 )
  961.     ROM_LOAD( "troj-06.rom",  0x10000, 0x8000, 0xdee6ed92 )
  962.     ROM_LOAD( "tb05.bin",     0x18000, 0x8000, 0x9273b264 )
  963.  
  964.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  965.     ROM_LOAD( "tb02.bin",     0x0000, 0x8000, 0x21154797 )
  966.  
  967.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for ADPCM CPU (CPU not emulated) */
  968.     ROM_LOAD( "tb01.bin",     0x0000, 0x4000, 0x1c0f91b2 )
  969.  
  970.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  971.     ROM_LOAD( "tb03.bin",     0x00000, 0x4000, 0x581a2b4c )     /* characters */
  972.  
  973.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  974.     ROM_LOAD( "tb13.bin",     0x00000, 0x8000, 0x285a052b )     /* tiles */
  975.     ROM_LOAD( "tb09.bin",     0x08000, 0x8000, 0xaeb693f7 )
  976.     ROM_LOAD( "tb12.bin",     0x10000, 0x8000, 0xdfb0fe5c )
  977.     ROM_LOAD( "tb08.bin",     0x18000, 0x8000, 0xd3a4c9d1 )
  978.     ROM_LOAD( "tb11.bin",     0x20000, 0x8000, 0x00f0f4fd )
  979.     ROM_LOAD( "tb07.bin",     0x28000, 0x8000, 0xdff2ee02 )
  980.     ROM_LOAD( "tb14.bin",     0x30000, 0x8000, 0x14bfac18 )
  981.     ROM_LOAD( "tb10.bin",     0x38000, 0x8000, 0x71ba8a6d )
  982.  
  983.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  984.     ROM_LOAD( "tb18.bin",     0x00000, 0x8000, 0x862c4713 )     /* sprites */
  985.     ROM_LOAD( "tb16.bin",     0x08000, 0x8000, 0xd86f8cbd )
  986.     ROM_LOAD( "tb17.bin",     0x10000, 0x8000, 0x12a73b3f )
  987.     ROM_LOAD( "tb15.bin",     0x18000, 0x8000, 0xbb1a2769 )
  988.     ROM_LOAD( "tb22.bin",     0x20000, 0x8000, 0x39daafd4 )
  989.     ROM_LOAD( "tb20.bin",     0x28000, 0x8000, 0x94615d2a )
  990.     ROM_LOAD( "tb21.bin",     0x30000, 0x8000, 0x66c642bd )
  991.     ROM_LOAD( "tb19.bin",     0x38000, 0x8000, 0x81d5ab36 )
  992.  
  993.     ROM_REGION( 0x10000, REGION_GFX4 | REGIONFLAG_DISPOSE )
  994.     ROM_LOAD( "tb25.bin",     0x00000, 0x8000, 0x6e38c6fa )     /* Bk Tiles */
  995.     ROM_LOAD( "tb24.bin",     0x08000, 0x8000, 0x14fc6cf2 )
  996.  
  997.     ROM_REGION( 0x08000, REGION_GFX5 )
  998.     ROM_LOAD( "tb23.bin",     0x00000, 0x08000, 0xeda13c0e )  /* Tile Map */
  999. ROM_END
  1000.  
  1001. /***************************************************************************
  1002.  
  1003.  Avengers - Doesn't work properly due to copy protection
  1004.  
  1005.  ***************************************************************************/
  1006.  
  1007. extern int avengers_interrupt(void);
  1008.  
  1009. WRITE_HANDLER( avengers_protection_w ){
  1010. }
  1011.  
  1012. READ_HANDLER( avengers_protection_r ){
  1013.     /* the protection reads are used for background palette among other things */
  1014.     static int hack;
  1015.     hack = hack&0xf;
  1016.     return hack++;
  1017. }
  1018.  
  1019.  
  1020. /*
  1021. E2 00 E4 03 E6 0C E8 10 EA 19 EC 25 EE 38 F0 3B F2 3E F4 49 F4 s
  1022. */
  1023. struct ADPCMsample avengers_samples[] =
  1024. {
  1025.     { 0x00, 0x00e2, (0x03e4 -0x00e2)*2 },
  1026.     { 0x01, 0x03e4, (0x0ce6 -0x03e4)*2 },
  1027.     { 0x02, 0x0ce6, (0x10e8 -0x0ce6)*2 },
  1028.     { 0x03, 0x10e8, (0x19ea -0x10e8)*2 },
  1029.     { 0x04, 0x19ea, (0x25ec -0x19ea)*2 },
  1030.     { 0x05, 0x25ec, (0x38ee -0x25ec)*2 },
  1031.     { 0x06, 0x38ee, (0x3bf0 -0x38ee)*2 },
  1032.     { 0x07, 0x3bf0, (0x3ef2 -0x3bf0)*2 },
  1033.     { 0x08, 0x3ef2, (0x49f4 -0x3ef2)*2 }
  1034. };
  1035.  
  1036. static void avengers_adpcm_init(const struct ADPCMinterface *adpcm_intf, struct ADPCMsample *sample_list, int max)
  1037. {
  1038.     memcpy(sample_list,avengers_samples,sizeof(avengers_samples));
  1039. }
  1040.  
  1041. static struct ADPCMinterface avengers_adpcm_interface =
  1042. {
  1043.     1,                      /* 1 channel */
  1044.     4000,                   /* 4000Hz playback */
  1045.     REGION_CPU3,            /* memory region */
  1046.     avengers_adpcm_init,    /* init function */
  1047.     { 255 }
  1048. };
  1049.  
  1050. /*
  1051. machine driver is exactly the same as trojan apart from
  1052. a new custom interrupt handler and slightly different videohardware
  1053. */
  1054.  
  1055. static struct MachineDriver machine_driver_avengers =
  1056. {
  1057.     /* basic machine hardware */
  1058.     {
  1059.         {
  1060.             CPU_Z80,
  1061.             4000000,        /* 4 Mhz (?) */
  1062.             readmem,trojan_writemem,0,0,
  1063.             avengers_interrupt,2
  1064.         },
  1065.         {
  1066.             CPU_Z80 | CPU_AUDIO_CPU,
  1067.             3000000,        /* 3 Mhz (?) */
  1068.             sound_readmem,sound_writemem,0,0,
  1069.             interrupt,4
  1070.         }
  1071.     },
  1072.     60, 2500,       /* frames per second, vblank duration */
  1073.                 /* hand tuned to get rid of sprite lag */
  1074.     1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  1075.     0,
  1076.  
  1077.     /* video hardware */
  1078.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
  1079.     gfxdecodeinfo_trojan,
  1080.     1024, 1024,
  1081.     0,
  1082.  
  1083.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_AFTER_VBLANK,
  1084.     0,
  1085.     avengers_vh_start,
  1086.     trojan_vh_stop,
  1087.     trojan_vh_screenrefresh,
  1088.  
  1089.     /* sound hardware */
  1090.     0,0,0,0,
  1091.     {
  1092.         {
  1093.             SOUND_YM2203,
  1094.             &ym2203_interface,
  1095.         },
  1096.         {
  1097.             SOUND_ADPCM,
  1098.             &avengers_adpcm_interface
  1099.         }
  1100.     }
  1101. };
  1102.  
  1103. INPUT_PORTS_START( avengers )
  1104.     PORT_START      /* IN0 */
  1105.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  1106.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  1107.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  1108.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  1109.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  1110.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  1111.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  1112.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  1113.  
  1114.     PORT_START      /* IN1 */
  1115.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  1116.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  1117.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  1118.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  1119.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  1120.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  1121.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1122.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  1123.  
  1124.     PORT_START      /* IN2 */
  1125.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  1126.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  1127.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  1128.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  1129.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  1130.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  1131.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1132.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  1133.  
  1134.     PORT_START      /* DSWB */
  1135.     PORT_DIPNAME( 0x01, 0x01, "Allow Continue" )
  1136.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  1137.     PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
  1138.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
  1139.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1140.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  1141.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
  1142.     PORT_DIPSETTING(    0x04, "Easy" )
  1143.     PORT_DIPSETTING(    0x0c, "Normal" )
  1144.     PORT_DIPSETTING(    0x08, "Hard" )
  1145.     PORT_DIPSETTING(    0x00, "Very Hard" )
  1146.     PORT_DIPNAME( 0x30, 0x30, "Bonus" )
  1147.     PORT_DIPSETTING(    0x30, "20k 60k" )
  1148.     PORT_DIPSETTING(    0x10, "20k 70k" )
  1149.     PORT_DIPSETTING(    0x20, "20k 80k" )
  1150.     PORT_DIPSETTING(    0x00, "30k 80k" )
  1151.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  1152.     PORT_DIPSETTING(    0xc0, "3" )
  1153.     PORT_DIPSETTING(    0x40, "4" )
  1154.     PORT_DIPSETTING(    0x80, "5" )
  1155.     PORT_DIPSETTING(    0x00, "6" )
  1156.  
  1157.     PORT_START      /* DSWA */
  1158.     PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
  1159.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  1160.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  1161.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1162.     PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) )
  1163.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  1164.     PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
  1165.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  1166.     PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
  1167.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
  1168.     PORT_DIPSETTING(    0x14, DEF_STR( 1C_3C ) )
  1169.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
  1170.     PORT_DIPSETTING(    0x18, DEF_STR( 1C_6C ) )
  1171.     PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
  1172.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  1173.     PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
  1174.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  1175.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
  1176.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
  1177.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
  1178.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
  1179.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_6C ) )
  1180. INPUT_PORTS_END
  1181.  
  1182. ROM_START( avengers )
  1183.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  1184.     ROM_LOAD( "04.10n",       0x00000, 0x8000, 0xa94aadcc )
  1185.     ROM_LOAD( "06.13n",       0x10000, 0x8000, 0x39cd80bd )
  1186.     ROM_LOAD( "05.12n",       0x18000, 0x8000, 0x06b1cec9 )
  1187.  
  1188.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1189.     ROM_LOAD( "02.15h",       0x0000, 0x8000, 0x107a2e17 ) /* ?? */
  1190.  
  1191.     ROM_REGION( 0x10000, REGION_CPU3 )     /* ADPCM CPU (not emulated) */
  1192.     ROM_LOAD( "01.6d",        0x0000, 0x8000, 0xc1e5d258 ) /* adpcm player - "Talker" ROM */
  1193.  
  1194.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1195.     ROM_LOAD( "03.8k",        0x00000, 0x4000, 0x4a297a5c )  /* characters */
  1196.  
  1197.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE ) /* tiles */
  1198.     ROM_LOAD( "13.6b",        0x00000, 0x8000, 0x9b5ff305 ) /* plane 1 */
  1199.     ROM_LOAD( "09.6a",        0x08000, 0x8000, 0x08323355 )
  1200.     ROM_LOAD( "12.4b",        0x10000, 0x8000, 0x6d5261ba ) /* plane 2 */
  1201.     ROM_LOAD( "08.4a",        0x18000, 0x8000, 0xa13d9f54 )
  1202.     ROM_LOAD( "11.3b",        0x20000, 0x8000, 0xa2911d8b ) /* plane 3 */
  1203.     ROM_LOAD( "07.3a",        0x28000, 0x8000, 0xcde78d32 )
  1204.     ROM_LOAD( "14.8b",        0x30000, 0x8000, 0x44ac2671 ) /* plane 4 */
  1205.     ROM_LOAD( "10.8a",        0x38000, 0x8000, 0xb1a717cb )
  1206.  
  1207.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE ) /* sprites */
  1208.     ROM_LOAD( "18.7l",        0x00000, 0x8000, 0x3c876a17 ) /* planes 0,1 */
  1209.     ROM_LOAD( "16.3l",        0x08000, 0x8000, 0x4b1ff3ac )
  1210.     ROM_LOAD( "17.5l",        0x10000, 0x8000, 0x4eb543ef )
  1211.     ROM_LOAD( "15.2l",        0x18000, 0x8000, 0x8041de7f )
  1212.     ROM_LOAD( "22.7n",        0x20000, 0x8000, 0xbdaa8b22 ) /* planes 2,3 */
  1213.     ROM_LOAD( "20.3n",        0x28000, 0x8000, 0x566e3059 )
  1214.     ROM_LOAD( "21.5n",        0x30000, 0x8000, 0x301059aa )
  1215.     ROM_LOAD( "19.2n",        0x38000, 0x8000, 0xa00485ec )
  1216.  
  1217.     ROM_REGION( 0x10000, REGION_GFX4 | REGIONFLAG_DISPOSE ) /* bg tiles */
  1218.     ROM_LOAD( "25.15n",       0x00000, 0x8000, 0x230d9e30 ) /* planes 0,1 */
  1219.     ROM_LOAD( "24.13n",       0x08000, 0x8000, 0xa6354024 ) /* planes 2,3 */
  1220.  
  1221.     ROM_REGION( 0x08000, REGION_GFX5 )
  1222.     ROM_LOAD( "23.9n",        0x0000, 0x08000, 0xc0a93ef6 )  /* Tile Map */
  1223. ROM_END
  1224.  
  1225. ROM_START( avenger2 )
  1226.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for code + 3*16k for the banked ROMs images */
  1227.     ROM_LOAD( "avg4.bin",     0x00000, 0x8000, 0x0fea7ac5 )
  1228.     ROM_LOAD( "avg6.bin",     0x10000, 0x8000, 0x491a712c )
  1229.     ROM_LOAD( "avg5.bin",     0x18000, 0x8000, 0x9a214b42 )
  1230.  
  1231.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1232.     ROM_LOAD( "02.15h",       0x0000, 0x8000, 0x107a2e17 ) /* MISSING from this set */
  1233.  
  1234.     ROM_REGION( 0x10000, REGION_CPU3 )     /* ADPCM CPU (not emulated) */
  1235.     ROM_LOAD( "01.6d",        0x0000, 0x8000, 0xc1e5d258 ) /* adpcm player - "Talker" ROM */
  1236.  
  1237.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1238.     ROM_LOAD( "03.8k",        0x00000, 0x4000, 0x4a297a5c )  /* characters */
  1239.  
  1240.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE ) /* tiles */
  1241.     ROM_LOAD( "13.6b",        0x00000, 0x8000, 0x9b5ff305 ) /* plane 1 */
  1242.     ROM_LOAD( "09.6a",        0x08000, 0x8000, 0x08323355 )
  1243.     ROM_LOAD( "12.4b",        0x10000, 0x8000, 0x6d5261ba ) /* plane 2 */
  1244.     ROM_LOAD( "08.4a",        0x18000, 0x8000, 0xa13d9f54 )
  1245.     ROM_LOAD( "11.3b",        0x20000, 0x8000, 0xa2911d8b ) /* plane 3 */
  1246.     ROM_LOAD( "07.3a",        0x28000, 0x8000, 0xcde78d32 )
  1247.     ROM_LOAD( "14.8b",        0x30000, 0x8000, 0x44ac2671 ) /* plane 4 */
  1248.     ROM_LOAD( "10.8a",        0x38000, 0x8000, 0xb1a717cb )
  1249.  
  1250.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE ) /* sprites */
  1251.     ROM_LOAD( "18.7l",        0x00000, 0x8000, 0x3c876a17 ) /* planes 0,1 */
  1252.     ROM_LOAD( "16.3l",        0x08000, 0x8000, 0x4b1ff3ac )
  1253.     ROM_LOAD( "17.5l",        0x10000, 0x8000, 0x4eb543ef )
  1254.     ROM_LOAD( "15.2l",        0x18000, 0x8000, 0x8041de7f )
  1255.     ROM_LOAD( "22.7n",        0x20000, 0x8000, 0xbdaa8b22 ) /* planes 2,3 */
  1256.     ROM_LOAD( "20.3n",        0x28000, 0x8000, 0x566e3059 )
  1257.     ROM_LOAD( "21.5n",        0x30000, 0x8000, 0x301059aa )
  1258.     ROM_LOAD( "19.2n",        0x38000, 0x8000, 0xa00485ec )
  1259.  
  1260.     ROM_REGION( 0x10000, REGION_GFX4 | REGIONFLAG_DISPOSE )
  1261.     ROM_LOAD( "25.15n",       0x00000, 0x8000, 0x230d9e30 ) /* planes 0,1 */
  1262.     ROM_LOAD( "24.13n",       0x08000, 0x8000, 0xa6354024 ) /* planes 2,3 */
  1263.  
  1264.     ROM_REGION( 0x08000, REGION_GFX5 )
  1265.     ROM_LOAD( "23.9n",        0x0000, 0x08000, 0xc0a93ef6 )  /* Tile Map */
  1266. ROM_END
  1267.  
  1268.  
  1269. GAME( 1986, lwings,   0,        lwings,   lwings,   0, ROT270, "Capcom", "Legendary Wings (US set 1)" )
  1270. GAME( 1986, lwings2,  lwings,   lwings,   lwings,   0, ROT270, "Capcom", "Legendary Wings (US set 2)" )
  1271. GAME( 1986, lwingsjp, lwings,   lwings,   lwings,   0, ROT270, "Capcom", "Ales no Tsubasa (Japan)" )
  1272. GAME( 1985, sectionz, 0,        lwings,   sectionz, 0, ROT0,   "Capcom", "Section Z (set 1)" )
  1273. GAME( 1985, sctionza, sectionz, lwings,   sectionz, 0, ROT0,   "Capcom", "Section Z (set 2)" )
  1274. GAME( 1986, trojan,   0,        trojan,   trojanls, 0, ROT0,   "Capcom", "Trojan (US)" )
  1275. GAME( 1986, trojanr,  trojan,   trojan,   trojan,   0, ROT0,   "Capcom (Romstar license)", "Trojan (Romstar)" )
  1276. GAME( 1986, trojanj,  trojan,   trojan,   trojan,   0, ROT0,   "Capcom", "Tatakai no Banka (Japan)" )
  1277. GAMEX(1987, avengers, 0,        avengers, avengers, 0, ROT270, "Capcom", "Avengers (set 1)", GAME_NOT_WORKING | GAME_WRONG_COLORS )
  1278. GAMEX(1987, avenger2, avengers, avengers, avengers, 0, ROT270, "Capcom", "Avengers (set 2)", GAME_NOT_WORKING | GAME_WRONG_COLORS )
  1279.